package router

import (
	"demo/handler/service"
	"demo/middleware"
	"demo/pkg"
	"github.com/gin-gonic/gin"
)

func Router() *gin.Engine {
	r := gin.Default()
	r.POST("/sms", service.SendSms)
	r.POST("/register", service.Register)
	r.POST("/login", service.Login)
	//r.GET("/chat", service.Chat)
	r.GET("/chat", pkg.Chat)
	userApi := r.Group("/auth").Use(middleware.AuthToken())
	{
		userApi.GET("/getUser", service.GetUser)
	}
	friendApi := r.Group("/auth").Use(middleware.AuthToken())
	{
		friendApi.GET("/searchFriend", service.SearchFriend)
		friendApi.GET("/getFriend", service.GetFriend)
		friendApi.POST("/addFriend", service.AddFriend)
		friendApi.POST("/friendApply", service.FriendApply)
	}
	blackApi := r.Group("/auth").Use(middleware.AuthToken())
	{
		blackApi.POST("/addBlack", service.AddBlack)
		blackApi.GET("/getBlack", service.GetBlack)
	}
	postApi := r.Group("/auth").Use(middleware.AuthToken())
	{
		postApi.POST("/addPost", service.AddPost)
		postApi.GET("/getPost", service.GetPost)
	}
	likeApi := r.Group("/auth").Use(middleware.AuthToken())
	{
		likeApi.POST("/addLike", service.AddLike)
	}
	//messageApi := r.Group("/auth").Use(middleware.AuthToken())
	//{
	//	messageApi.GET("/getMessage", service.GetMessage)
	//}
	return r
}
